const events = require('events')

const e = new events.EventEmitter()

e.on('close', () => {
    console.log('close')
})

setTimeout(() => {
    console.log('settimeout')
    e.emit('close')
}, 1000);

console.log('end')